package com.ywu.standard.menu.api;

import com.ywu.common.result.CommonResult;
import com.ywu.standard.menu.dto.RouterPathDto;
import com.ywu.standard.menu.service.RouterPathService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName RouterPathApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/3/30 19:36
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/menu/router")
public class RouterPathApi {
    @Autowired
    private RouterPathService service;

    /**
    * @Author GroundDemo
    * @Description 添加文根
    * @Date 19:51 2024/3/30
    * @Param [routerPathDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/root.path.create")
    public CommonResult<Object> createRouteRootPath(@RequestBody RouterPathDto routerPathDto) {
        return service.createRouteRootPath(routerPathDto);
    }

    /**
    * @Author GroundDemo
    * @Description 更新文根
    * @Date 19:53 2024/3/30
    * @Param [routerPathDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/root.path.update")
    public CommonResult<Object> updateRouteRootPath(@RequestBody RouterPathDto routerPathDto) {
        return service.updateRouteRootPath(routerPathDto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除文根
    * @Date 19:54 2024/3/30
    * @Param [routerPathDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/root.path.delete")
    public CommonResult<Object> deleteRouteRootPath(@RequestBody RouterPathDto routerPathDto) {
        return service.deleteRouteRootPath(routerPathDto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询文根列表
    * @Date 19:55 2024/3/30
    * @Param [routerPathDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/root.path.info")
    public CommonResult<Object> queryRouteRootPath(@RequestBody RouterPathDto routerPathDto) {
        return service.queryRouteRootPath(routerPathDto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询当前用户可以进入的路由文根（站点）
    * @Date 17:56 2024/8/25
    * @Param []
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/root.route.site.info")
    public CommonResult<Object> queryRouteSite() {
        return service.queryRouteSite();
    }
}
